package com.bilibili.interface1;

public class ClassDataInterlmpl1 implements ClassDatalnter{
    private Student[] students;

    public ClassDataInterlmpl1(Student students[]){
        this.students=students;
    }
    public ClassDataInterlmpl1(){}

    @Override
    public void printAllStudentInfos() {
        for(int i = 0 ; i < students.length ; i++){
            Student s = students[i];
            System.out.println(s.getName()+"\t"+s.getSex()+"\t"+s.getScore());
        }
    }
    @Override
    public void printAverageScore() {
        double all = 0 ;
        int n = 0;
        for(int i = 0 ; i < students.length ; i++){
            Student s = students[i];
            all+=s.getScore();
            n++;
        }
        double score = all/n;
        System.out.println("平均分是"+score);
    }
}

